<?php
$title = '账户';
$this->headTitle($title);
?>
<h1><?php echo $this->escapeHtml($title . '管理'); ?></h1>
<hr>
<ul id="account" class="nav nav-tabs">
    <li class="">
        <a href="#" data-toggle="tab" id="index">所有账户</a>
    </li>
    <li class="">
        <a href="#" data-toggle="tab" id="check">支票账户</a>
    </li>
    <li class="active">
        <a href="#" data-toggle="tab" id="thrift">储蓄账户</a>
    </li>
</ul>
<h3><?php echo $this->escapeHtml('储蓄' . $title); ?></h3>
<hr>
<table class="table table-hover table-striped">
    <tr>
        <th>账户号</th>
        <th>银行</th>
        <th>利率</th>
        <th>利润</th>
        <th>余额</th>
        <th>存取</th>
    </tr>
    <?php foreach ($this->thrift as $key => $thrift) { ?>
        <tr>
            <td><?php echo $thrift['account_id']; ?></td>
            <td><?php echo $thrift['bank_name']; ?></td>
            <td><?php echo $thrift['rate'] * 100; ?>%</td>
            <td><?php echo $thrift['account_balance'] * $thrift['rate']; ?></td>
            <td><?php echo $thrift['account_balance']; ?></td>
            <td>
                <a href="<?php echo $this->url("account/default", array("controller" => "access", "action" => "index", "id" => $thrift['account_id'])); ?>">查看</a>
            </td>
        </tr>
    <?php } ?>
</table>
<script type="text/javascript">
    $("#index").click(function () {
        window.location.replace("<?php echo $this->url('account/default', array('controller' => 'account', 'action' => 'index'));?>");
    });
    $("#check").click(function () {
        window.location.replace("<?php echo $this->url('account/default', array('controller' => 'account', 'action' => 'check'));?>");
    });
    $("#thrift").click(function () {
        window.location.replace("<?php echo $this->url('account/default', array('controller' => 'account', 'action' => 'thrift'));?>");
    });
</script>